	function CourseMy() {
		this.objComm = null;
		this.objCourse = null;
	};
	
	CourseMy.prototype = {
			onPageShow: function() {
				this._init();
			}
			, _init: function(){
				
				$("a").attr("href","");
				
				this._role();
		    
			}
			, _start: function(){
				
				this.objComm = new CourseMy_Comm();
	      this.objCourse = new clsCourseMy();
	      	       
	      //프로필정보 조회
	      this.spinStart();
	      this.objComm.setCourseRequest("페이지",1);
	      this.objComm.getCourseTarget();
	      this._bind();
			}
			, _bind: function(){
				var thisClass = this;
				
				//코스목록 조회 완료이벤트
				$(this.objComm).bind("evtFinishCourse", function(event){
					var thisData = thisClass.objComm.getCourseTargetData();
					thisClass.objCourse.totalCount = thisClass.objComm.getTotalCount();
					thisClass.objCourse.setList(thisData);
					thisClass.spinEnd();
				});
				
				//글쓰기 버튼 이벤트
				$("section#course_my>section div.btn_area06 a").click(function(event) {
					$.mobile.changePage( "course_write.html","slide",true);
				});
				
				//최신게시글 버튼 이벤트
				$("section#course_my>footer li:eq(0)").click(function(event) {
					$.mobile.changePage( "course.html","slide",true);
				});
				
				//검색 버튼 이벤트
				$("section#course_my>footer li:eq(2)").click(function(event) {
					$.mobile.changePage( "course_search.html","slide",true);
				});
				
				//더보기 버튼 이벤트
				$("section#course_my>section div.btn_more").click(function(event) {
					var page = thisClass.objComm.getCourseRequest("페이지");
			 		thisClass.objComm.setCourseRequest("페이지",(page+1));
			 		thisClass.objComm.getCourseTarget();
				});
				
				//상세보기 이벤트
				this.objCourse.$getLayer().on("click","li", function(event){
					var idx = thisClass.objCourse.$getLayer().find(">li").index($(this));
					var obj = thisClass.objCourse.listData;
					if(!_gf.COURSE_DATA) _gf.COURSE_DATA = "";
						_gf.COURSE_DATA = {
							"키": obj[idx]["키"]
							, "나이스샷수" : obj[idx]["나이스샷수"]
							, "리턴주소": "course_my.html"
						}
				//	alert(obj[idx]["내용"] + ':' + obj[idx]["키"]);
					$.mobile.changePage( "course_view.html","slide",true);
				});
			}
			, _role: function(){
				if(!_util.getLogin("로그인")){
					//alert("로그인 후 이용하실 수 있습니다.");
					this.goNavi("../course/course_my.html");		
					return;
				}else {
					this._start();	    		
				}
	   	}
			, goNavi: function(rPage){			
				_gf.LOGIN_DATA.loginAfterUrl = rPage;
				$.mobile.changePage("../member/login.html","slide",true);
			}
			, spinStart: function(){
				$.mobile.showPageLoadingMsg();
			}
			, spinEnd: function(){
				$.mobile.hidePageLoadingMsg();
			}
			
	}
	
	//데이터연동		
	function CourseMy_Comm(){
		this.courseTargetList = null;		
		this.courseRequest = null;
		this.totalCount = null;
		
		this._init();		
	}
	CourseMy_Comm.prototype = {
		_init: function(){
			this.courseRequest = {
				"아이디": "dlendus"	
				, "페이지": null
			}
		}
		, getCourseTarget: function(){
			var thisClass = this;
			
			
			var objJson = new MJson();
			var cm = new ConnectionManager();

			objJson.putPub(MJson.PUB.SID, "KB001");
			objJson.putPub(MJson.PUB.SERVICENAME, "getKnowhowBoardList");
			objJson.putPub(MJson.PUB.LISTCOUNT, 10);
			objJson.putPub(MJson.PUB.CURRPAGENO, thisClass.getCourseRequest("페이지"));
			
			objJson.putParameter("reg_nickname", _util.getLogin("닉네임"));
			
			//_util.ajaxLog(objJson.getJsonString());

			cm.requestGet(objJson.getJsonString(), function($jsonData){
				
				var res = $jsonData["msp"]["contents"]["items"];
				thisClass.totalCount = $jsonData["msp"]["contents"]["@totalcount"];
				thisClass.courseTargetList = [];
				if(res){
					if(!res.length){
						res = new Array(res);	
					}
					
					for(var i=0;i<res.length;++i){
						var obj = res;
							thisClass.courseTargetList.push({
								"키": _util.nvl(obj[i].board__seq)
								, "제목": _util.nvl(obj[i].title)
								, "내용": _util.nvl(obj[i].content)
								, "닉네임": _util.nvl(obj[i].reg__nickname)
								, "나이스샷수": _util.nvl(obj[i].niceshot)
								, "댓글수": _util.nvl(obj[i].cr__cnt)
								, "등록일자": _util.nvl(obj[i].reg__date)
								, "등록시간": _util.nvl(obj[i].reg__time)
								, "골프장": _util.nvl(obj[i].golfclub__name)
								, "코스": _util.nvl(obj[i].course__info__name)
								, "직접입력": _util.nvl(obj[i].userWriteYn)
								, "골프장데이터": _util.nvl(obj[i].golfclub__data)
								, "코스데이터": _util.nvl(obj[i].course__data)
							});
					}
				}
				$(thisClass).trigger("evtFinishCourse");
			}, function($err) {
				alert($err);
			});
			/*
			setTimeout(function(){
				
				thisClass.courseTargetList = [{
					"키": "1"
					, "제목": "스카이 골프"
					, "내용": "제목이 노출"
					, "닉네임": "재니클라"
					, "나이스샷수": "1"
					, "댓글수": "0"
					, "등록일자": "20120727"
					, "등록시간": "1520"
				}
				,{
					"키": "2"
					, "제목": "스카이 골프1"
					, "내용": "제목이 노출1"
					, "닉네임": "재니클라1"
					, "나이스샷수": "2"
					, "댓글수": "2"
					, "등록일자": "20120727"
					, "등록시간": "1520"
				}
				,{
					"키": "3"
					, "제목": "스카이 골프3"
					, "내용": "제목이 노출3"
					, "닉네임": "재니클라3"
					, "나이스샷수": "3"
					, "댓글수": "3"
					, "등록일자": "20120727"
					, "등록시간": "1520"
				}];
				
				$(thisClass).trigger("evtFinishCourse");
			}, 1000);*/
		}
		, getCourseTargetData: function(){
			return this.courseTargetList;
		}
		, setCourseRequest: function(key,val){
			this.courseRequest[key]=val;
		}
		, getCourseRequest: function(key){
			return this.courseRequest[key];
		}
		, getTotalCount: function(){
			return this.totalCount;
		}
	}
	
	function clsCourseMy(){
		this.listData = null;
		this.totalCount = null;
		this._HTMLDom = null;
		this._init();
	}
	
	clsCourseMy.prototype = {
		_init: function(){
			var $layer = $("section#course_my>section>ul");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find(">li:first")
			}

			$layer.empty();
		}
		, setList: function(thisData){
			if(!this.listData) {			
				this.listData = [];	
			}
			
			this.push(thisData);
			
			//this.listData = thisData;
			//this.display();
		}
		, push: function(thisData){
			var $element = this._HTMLDom["$element"];
			var $tmp = [];
			
			for(var i=0;i<thisData.length;++i){
				
				$tmp.push($element.clone(true));
				if(thisData[i]["직접입력"] == "Y"){
					$tmp[i].find("h5").html(thisData[i]["골프장데이터"] + "&nbsp;" + thisData[i]["코스데이터"]);
				}else{
					$tmp[i].find("h5").html(thisData[i]["골프장"] + "&nbsp;" + thisData[i]["코스"]);
				}
				$tmp[i].find("div.sub").html(thisData[i]["제목"]);
				$tmp[i].find("ul>li:eq(0)").html(thisData[i]["닉네임"]);
				$tmp[i].find("ul>li:eq(1) mark").html("(" + thisData[i]["나이스샷수"] + ")");
				$tmp[i].find("ul>li:eq(2) mark").html("(" + thisData[i]["댓글수"] + ")");
				$tmp[i].find("ul>li:eq(3)").html(_util.fDateYmd(thisData[i]["등록일자"]) + "&nbsp;" + _util.fTime(thisData[i]["등록시간"]));
				this.listData.push(thisData[i]);
			}
			
			if(this.listData.length == this.totalCount){
				$("section#course>section div.btn_more").hide();
			}else{
				$("section#course>section div.btn_more").show();
			}
			
			this.display($tmp);
		}
		, display: function(thisData){
			var $layer = this._HTMLDom["$layer"];
			
			for(var i=0;i<thisData.length;++i){
				$layer.append(thisData[i]);	
			}
		}
		, $getLayer: function(){
				return this._HTMLDom["$layer"];
		}
	}
	
	
//	$(document).bind("pageinit", function(event){
//		//alert("pageinit");
//		
//		var path = String(document.location);
//		if(path.indexOf("navi.html") == -1){
//			document.objControl = new CourseMy();
//			document.objControl.onPageShow();	
//		}
//	});